package com.wangzhixuan.apiController;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wangzhixuan.commons.base.ApiBaseController;
import com.wangzhixuan.commons.constant.ApiCode;
import com.wangzhixuan.model.vo.AchievementsVo;
import com.wangzhixuan.service.IBaseInfoService;
import com.wangzhixuan.service.IRankService;
import com.wangzhixuan.service.impl.RankServiceImpl;

/**
 * <p>
 *   前端控制器
 * </p>
 * @author zhixuan.wang
 * @since 2017-07-16
 */
@Controller
@RequestMapping("/api/achievements")
public class AchievementsApiController extends ApiBaseController {
    
    @Autowired private IBaseInfoService baseInfoService;
    
    @Autowired private IRankService iRankService;
	
    /**
     * 获得单人排名以及任务完成数量
     * @param achievementsVo
     * @return
     */
    @RequestMapping("/detailed")
    @ResponseBody
	public Object detailed(AchievementsVo achievementsVo){
    	Map<String, Object> selectAchievementsDetail = baseInfoService.selectAchievementsDetail(achievementsVo);
    	return renderSuccess(ApiCode.CODE_200, "成功",selectAchievementsDetail);
	}
    
    /**
     * 获取所有人的排名
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
	public Object list(){
    	List<Map<String,Object>> selectlist = iRankService.selectlist();
    	return renderSuccess(ApiCode.CODE_200, "成功",selectlist);
	}
}

